var t = require;
var e = module;
var o = exports;
var n =
        (this && this.__extends) ||
        (function () {
            var t = function (e, o) {
                return (t =
                    Object.setPrototypeOf ||
                    ({__proto__: []} instanceof Array &&
                        function (t, e) {
                            t.__proto__ = e;
                        }) ||
                    function (t, e) {
                        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                    })(e, o);
            };
            return function (e, o) {
                function n() {
                    this.constructor = e;
                }
                t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
            };
        })(),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var r,
                a = arguments.length,
                i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
            return a > 3 && i && Object.defineProperty(e, o, i), i;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var a = t("SpriteLoad"),
    i = t("Util"),
    s = t("Prefabs"),
    c = t("Sounds"),
    l = t("fightManager"),
    u = cc._decorator,
    p = u.ccclass,
    f = u.property,
    d = (function (t) {
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            return (e.sload = null), (e.box = null), (e.speedmin = 120), (e.speedmax = 140), e;
        }
        return (
            n(e, t),
            (e.prototype.set = function (t, e, o, n) {
                (this.node.x = t),
                    (this.node.y = e),
                    (this.fx = o),
                    (this.data = n),
                    (this.node.scale = n.Scale),
                    (this.node.scaleX *= 1 == o ? 1 : -1),
                    (this.sload.url.value = n.PicID),
                    (this.sload.node.x = n.chushi[0]),
                    (this.sload.node.y = n.chushi[1]),
                    (this.speed = i.RandomInt(this.speedmin, this.speedmax)),
                    (this.box.size = cc.size(n.daxiaohit[0], n.daxiaohit[1]));
            }),
            (e.prototype.update = function (t) {
                var e = l.default.gamedt(t) * this.speed;
                1 == this.fx
                    ? ((this.node.x -= e), this.node.x < -1444 && this.node.destroy())
                    : ((this.node.x += e), this.node.x > 1444 && this.node.destroy());
            }),
            (e.prototype.onCollisionEnter = function () {
                var t = s.instantiate("ruins");
                (t.x = this.node.x + this.data.RuinOffset[0]),
                    (t.y = this.node.y + this.data.RuinOffset[1]),
                    l.default.inst.bg.addChild(t),
                    (t.getComponent(a.default).url.value = this.data.RuinID);
                var e = s.instantiate("carBomb");
                (e.x = t.x),
                    (e.y = t.y),
                    l.default.inst.bg.addChild(e),
                    this.node.destroy(),
                    c.Sounds.playFX("爆" + i.RandomInt(1, 2));
            }),
            r([f(a.default)], e.prototype, "sload", void 0),
            r([f(cc.BoxCollider)], e.prototype, "box", void 0),
            (e = r([p], e))
        );
    })(cc.Component);
o.default = d;
